Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename EntityCache to EntityStore. #5618

Merged
merged 1 commit into from
Nov 25, 2019

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Nov 25, 2019

This PR builds on #5617, but you do not need to review those changes first.

I believe the job of a GraphQL cache is not simply to remember the results of past GraphQL queries, but to ingest those queries into a client-side data graph that faithfully replicates a subset of the complete data graph described by your schema.

To that end, the name EntityCache feels slightly inaccurate, because this data structure is the source of truth for your client-side data graph, which consists of entity objects, their fields, and their references to each other, to name just a few concepts that transcend the particulars of caching GraphQL results.

Instead, I think EntityStore more accurately reflects the first-class status of the client-side data graph, with the InMemoryCache as a wrapper of the EntityStore and a consumer of the entity objects that reside within it.

If you're curious about the philosophy behind this separation of concerns, check out my talk from GraphQL Summit.

If you don't care about the names of these abstractions, you can rest easy knowing that this change is (in some sense) purely cosmetic. ✨

I believe the job of a GraphQL cache is not simply to remember the results
of past GraphQL queries, but to ingest those queries into a client-side
data graph that faithfully replicates a subset of the complete data graph
described by your schema.

To that end, the name `EntityCache` feels slightly inaccurate, because
this data structure is the source of truth for your client-side data
graph, which consists of entity objects, their fields, and their
references to each other, to name just a few concepts that transcend the
particulars of caching GraphQL results.

Instead, I think `EntityStore` more accurately reflects the first-class
status of the client-side data graph, with the `InMemoryCache` as a
wrapper of the `EntityStore` and a consumer of the entity objects that
reside within it.

If you're curious about the philosophy behind this separation of concerns,
check out my talk from GraphQL Summit: https://youtu.be/n_j8QckQN5I?t=114

If you don't care about the names of these abstractions, you can rest easy
knowing that this change is (in some sense) purely cosmetic.
@benjamn benjamn added this to the Release 3.0 milestone Nov 25, 2019
@benjamn benjamn self-assigned this Nov 25, 2019
Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this - using cache for both EntityCache and InMemoryCache (with one essentially wrapping the other) had the potential to confuse contributors. I definitely think this is more clear (and I care about abstractions probably way more than I should 🙂). LGTM!

@benjamn benjamn changed the base branch from finer-grained-result-caching to release-3.0 November 25, 2019 21:17
@benjamn benjamn merged commit 1da898c into release-3.0 Nov 25, 2019
@benjamn benjamn deleted the rename-EntityCache-to-EntityStore branch November 25, 2019 21:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants